Fix CPU hotplug.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 9 Feb 2006 13:52:40 +0000 (14:52 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 9 Feb 2006 13:52:40 +0000 (14:52 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c
linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c
linux-2.6-xen-sparse/drivers/xen/core/smpboot.c

index a6f5ac0bd2b9ac24a499ed364d24732ced8d5936..e565ad83c7a9e8a8d8148c2d7c732612d0a47a61 100644 (file)
@@ -124,10 +124,18 @@ EXPORT_SYMBOL(default_idle);
 #endif
 
 #ifdef CONFIG_HOTPLUG_CPU
+extern cpumask_t cpu_initialized;
 static inline void play_dead(void)
 {
        idle_task_exit();
+       local_irq_disable();
+       cpu_clear(smp_processor_id(), cpu_initialized);
+       preempt_enable_no_resched();
        HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL);
+       /* Same as drivers/xen/core/smpboot.c:cpu_bringup(). */
+       cpu_init();
+       touch_softlockup_watchdog();
+       preempt_disable();
        local_irq_enable();
 }
 #else
index 096aab6eef69b42724edde41a7194db41168dfb4..55a3b5dfdce508f3218dedf23b92cbfd4e398148 100644 (file)
@@ -138,14 +138,17 @@ void xen_idle(void)
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
-DECLARE_PER_CPU(int, cpu_state);
-
-#include <asm/nmi.h>
-/* We halt the CPU with physical CPU hotplug */
 static inline void play_dead(void)
 {
        idle_task_exit();
+       local_irq_disable();
+       cpu_clear(smp_processor_id(), cpu_initialized);
+       preempt_enable_no_resched();
        HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL);
+       /* Same as drivers/xen/core/smpboot.c:cpu_bringup(). */
+       cpu_init();
+       touch_softlockup_watchdog();
+       preempt_disable();
        local_irq_enable();
 }
 #else
index 198cd836b552fa0b45eec0a7132cb71c7d880f17..d231f8502976d602d0bba069ff4cd9add5b0b354 100644 (file)
@@ -40,8 +40,6 @@ extern void failsafe_callback(void);
 extern void system_call(void);
 extern void smp_trap_init(trap_info_t *);
 
-extern cpumask_t cpu_initialized;
-
 /* Number of siblings per CPU package */
 int smp_num_siblings = 1;
 int phys_proc_id[NR_CPUS]; /* Package ID of each logical CPU */
@@ -141,10 +139,9 @@ static void xen_smp_intr_exit(unsigned int cpu)
 
 static void cpu_bringup(void)
 {
-       if (!cpu_isset(smp_processor_id(), cpu_initialized)) {
-               cpu_init();
-               preempt_disable();
-       }
+       cpu_init();
+       touch_softlockup_watchdog();
+       preempt_disable();
        local_irq_enable();
        cpu_idle();
 }